package com.heng.constants;

// 优惠券类型枚举
public enum CouponTypeEnum {
    NO_THRESHOLD(1, "无门槛券"),
    FULL_REDUCTION(2, "满减券");

    private final int code;
    private final String desc;

    CouponTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    // 根据code获取枚举
    public static CouponTypeEnum getByCode(int code) {
        for (CouponTypeEnum type : values()) {
            if (type.code == code) {
                return type;
            }
        }
        return null;
    }
}


